import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

class Test13 extends StatefulWidget {
  @override
  _Test13State createState() => _Test13State();
}

class _Test13State extends State<Test13> {
  bool checked = false;

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            Switch(
                value: checked,
                activeColor: Colors.red,
                activeTrackColor: Colors.red.withOpacity(.5),
                inactiveTrackColor: Colors.blue,
                inactiveThumbColor: Colors.blue.withOpacity(.5),
                onChanged: (value) {
                  setState(() {
                    checked = value;
                  });
                })
          ],
        ),
      ),
    );
  }
}
